import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @program: leetcode448
 * @author: JCM
 * @create: 2022-11-18 12:47
 * @description:
 **/
public class leetCode {
    public static void main(String[] args) {
        int[] nums = {4,3,2,7,8,2,3,1};
        List<Integer> ans = findDisappearedNumbers(nums);
        System.out.println(ans.toString());
    }

    private static List<Integer> findDisappearedNumbers(int[] nums) {
        List<Integer> list = new ArrayList<>();
        Set<Integer> set = new HashSet<>();

        for(int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }
        for(int i = 1; i <= nums.length ; i++) {
            if(!set.contains(i)) {
                list.add(i);
            }
        }
        return list;
    }
}
